//
//  GameResultViewController.m
//  MemoPocker
//
//  Created by Jose Luis Ferreyra on 10/07/13.
//  Copyright (c) 2013 Dharma. All rights reserved.
//

#import "GameResultViewController.h"
#import "GameResult.h"

@interface GameResultViewController ()
@property (weak, nonatomic) IBOutlet UITextView *gamelist;

@end

@implementation GameResultViewController

- (void) setup {
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}


- (void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self updateUI];
}

- (void) updateUI{
    NSString *textToShow = @"";
    for (GameResult *result in [GameResult allGameResults]) {
        textToShow = [textToShow stringByAppendingFormat: @ "Score: %d (%@, %g) \n", result.score, result.end , result.duration];
    }
    self.gamelist.text = textToShow;
}


@end
